home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / iutil / tup_len.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  809 b   |  46 lines

  1. # include    <ingres.h>
  2. # include    <access.h>
  3. # include    <sccs.h>
  4.  
  5. SCCSID(@(#)tup_len.c    8.1    12/31/84)
  6.  
  7. /*
  8. **    Tup_len finds the amount of space occupied by the
  9. **    tuple specified by "tid"
  10. */
  11.  
  12. tup_len(tid)
  13. TID    *tid;
  14. {
  15.     register short    *lp;
  16.     register int    nextoff, off;
  17.     int        lineoff, i;
  18.  
  19.  
  20.     /* point to line number table */
  21.     lp = (short *) Acc_head->linetab;
  22.  
  23.     /* find offset for tid */
  24.     lineoff = lp[-(tid->line_id & I1MASK)];
  25.  
  26.     /* assume next line number follows lineoff */
  27.     nextoff = lp[-Acc_head->nxtlino];
  28.  
  29.     /* look for the line offset following lineoff */
  30.     for (i = 0; i < Acc_head->nxtlino; i++)
  31.     {
  32.         off = *lp--;
  33.  
  34.         if (off <= lineoff)
  35.             continue;
  36.  
  37.         if (off < nextoff)
  38.             nextoff = off;
  39.     }
  40. #    ifdef xATR3
  41.     if (tTf(27, 8))
  42.         printf("tup_len ret %d\n", nextoff - lineoff);
  43. #    endif
  44.     return (nextoff - lineoff);
  45. }
  46.